package com.example.SpringBoot_demo.service.impl;


import com.example.SpringBoot_demo.bean.Book;
import com.example.SpringBoot_demo.bean.User;
import com.example.SpringBoot_demo.mapper.BookMapper;
import com.example.SpringBoot_demo.service.IBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/*一开始这里少了个Service找了半天
*导致一直返回空指针
* */
@Service
public class BookServiceImpl implements IBookService {
    @Autowired
    private BookMapper bookMapper;


    @Override
    public List<Book> viewBook() {
        return bookMapper.viewBook();
    }

    @Override
    public void deleteBook(String bookId) {
        bookMapper.deleteBook(bookId);
    }

    @Override
    public void addBook(Book book) {
        bookMapper.addBook(book);
    }

    @Override
    public void changeBook(Book book) {
        bookMapper.changeBook(book);
    }

    @Override
    public Book getBookById(String bookId) {
        return bookMapper.getBookById(bookId);
    }

    @Override
    public List<Book> getBook(String bookId, String bookName) {
        return bookMapper.getBook(bookId, bookName);
    }
}
